﻿<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?php echo $this->Html->css(array('reset', 'layout', 'input', 'input_curto', 'auto-complete', 'messages'));?>
<?php echo $this->Html->css(array('print'), null, array('media'=>'print'));?>
<?php echo $this->Html->script(array('jquery','DD_roudies', 'jquery-ui-1.8.18.autocomplete.min.js', 'tinyMCE/tiny_mce.js'));?>
<?php echo $this->Html->charset(); ?>
<?php echo $scripts_for_layout;?>
<script type="text/javascript">

	<?php // TODO Gravar o menu atual usando $_SESSION?>
	jQuery(function(){
		$('.menu li').not('.status').click(function(){
			if($(this).next().is(":visible")){var fechar = true;}
			// Desfazendo as alterações
			$('li.hidden').toggle();
			$('li').removeAttr('style');

			if(!fechar){
				// Aplicando as novas
				$(this).next().toggle();
				$(this).css('background-color', 'white');
				$(this).css('color', '#FE9E9E');
			}
		});
		$("textarea").attr("cols", "90").attr("rows", "20");
		if($("#flashMessage").is(":visible") || $('#authMessage').is(":visible")){
			$("#fundo").show();
			setTimeout(
				function(){
					$("#authMessage").fadeOut();
					$("#flashMessage").fadeOut();
					$("#fundo").fadeOut();
				},
				1800
			);
		};
	});

	tinyMCE.init({
			language : "pt",
	        mode : "textareas",
	        theme : "advanced",
	        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,"+
		        "separator,justifyleft,justifycenter,justifyright,justifyfull,undo,redo",
	        theme_advanced_buttons2 : "",
	        theme_advanced_buttons3 : "",
	        theme_advanced_toolbar_location : "top",
	        theme_advanced_toolbar_align : "left"
	});
		
</script>
<!-- <meta http-equiv="refresh" content="2"> --> 
</head>
<body>
	<div id="fundo"></div>
	<?php echo $this->Session->flash();?>
	<div class="header">
		<div>
			<h1>livrOS - Software Gerenciador da Biblioteca do GePeq - IQ - USP</h1>
		</div>
		<?php if($logado){?>
			<div id="dados_sessao">
			<span>Olá <?php echo $usuarioAtual['pNome'];?>! Seja bem vindo!</span>
			</div>
		<?php }?>
	</div>
	<div class="page">
		<div class="menu">
			<ul>
				<?php if($logado){?>			
				<li class="livros_menu">Obras</li>
				<li class="hidden livros_menu">
					<ul>
						<?php if($admin){?>
						<li><?php echo $this->Html->link('Novo Livro', '/livros/novo');?></li>
						<li><?php echo $this->Html->link('Novo Vídeo', '/livros/novo');?></li>
						<li><?php echo $this->Html->link('Nova Coleção', '/livros/adiciona_colecao');?></li>
						<?php }?>
						<li><?php echo $this->Html->link('Busca', '/livros/lista');?></li>
					</ul>
				</li>
				<?php if($admin){?>
				<li><?php echo $this->Html->link('Editoras', '/editoras/lista');?></li>
				<li>Usuários</li>
				<li class="hidden alunos_menu">
					<ul>
						<li><?php echo $this->Html->link('Novo', '/alunos/novo');?></li>
						<li><?php echo $this->Html->link('Busca', '/alunos/lista');?></li>
					</ul>
				</li>
				<li>Assuntos</li>
				<li class="hidden assuntos_menu">
					<ul>
						<li><?php echo $this->Html->link('Busca', '/assuntos/lista');?></li>
						<li><?php echo $this->Html->link('Novo', '/assuntos/novo');?></li>
					</ul>
				</li>
				<?php }?>
				<li>Empréstimos</li>
				<li class="hidden emprestimos_menu">
					<ul>
						<?php if($admin){?>
						<li><?php echo $this->Html->link('Fazer Empréstimo', '/emprestimos/novo');?></li>
						<li><?php echo $this->Html->link('Devolver livro', '/emprestimos/devolver_livro');?></li>
						<?php }?>
						<li><?php echo $this->Html->link('Empréstimos atuais', '/emprestimos/lista');?></li>
					</ul>
				</li>
				<li><?php echo $this->Html->link('Histórico de Empréstimos', '/historico_emprestimos/lista');?></li>
				<?php if($admin){?>
				<li><?php echo $this->Html->link('Configurações', '/configs');?></li>
				<?php }?>
				<li>Resenhas</li>
				<li class="hidden resenhas_menu">
					<ul>
						<li><?php echo $this->Html->link('Minhas Resenhas', '/resenhas/minhasResenhas');?></li>
						<?php if($admin){?>
						<li><?php echo $this->Html->link('Aprovar Resenha', '/resenhas/aprovarResenha');?></li>
						<li><?php echo $this->Html->link('Todas Resenhas', '/resenhas/lista');?></li>
						<?php }?>
					</ul>
				</li>
				<li>
					<?php echo $this->Html->link('Sair', '/alunos/logout')?>
				</li>
				<?php } else { ?>
				<li>
					<?php echo $this->Html->link('Entrar', '/alunos/login')?>
				</li>
				<?php } ?>
				<?php if($logado && $admin){?>
				<li>
					<?php echo $this->Html->link(
										'Manual de Ajuda',
										'https://docs.google.com/document/pub?id=1eHATfXSXmmC8bOYxBa0OkLhvXbXTt_Md5FxUxSgPaLI',
										array('target'=>'new'))?>
				</li>
				<li class="status">
				<?php echo $this->element('status');?>
				</li>
				<?php }?>
			</ul>
		</div>
		<div class="content">
			<?php echo $content_for_layout;?>
		</div>
		<div class="clear"></div>
	</div>
	<div class="rodape">
		<div>
		IMEJr - IME - USP - SP<br>
		Responsável pelo Projeto: <a id=email_contato href='mailto:willen.goulart@gmail.com'>Willen Goulart</a>
		</div>
	</div>
</body>
</html>
<?php //echo $this->element('sql_dump');?>